// pages/mvIndex/mvIndex.js
Page({

  data: {
  },

  onLoad: async function (options) {
    var type = options.type;
    var module = await import("../../utils/http");
    var dataModule = await import("../../utils/data");
    if(type == "top250"){
      var res = await module.MvHttp.getTop250();
      res = await dataModule.Data.handleHttpData(res.data.res);
    }else if(type == "coming"){
      var res = await module.MvHttp.getComingSoon();
      res = await dataModule.Data.handleHttpData(res.data.res);
    }else{
      var res = await module.MvHttp.getInTheaters();
      res = await dataModule.Data.handleinTheaterData(res.data.res);
    }
    this.setData({movie:res})
  },
  toDetail(event){
    var id = event.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/mvDetail/mvDetail?id=${id}`,
    })
  },
})